<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddUserOauthToTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('user_oauth', function (Blueprint $table) {
            /*字段配置--begin*/
            $table->string('wechat_mp_open_id')->default('')->nullable()->comment('微信小程序应用openid');
            $table->string('wechat_app_open_id')->default('')->nullable()->comment('微信移动应用openid');
            $table->string('wechat_web_open_id')->default('')->nullable()->comment('微信网页应用openid');
            $table->string('old_wechat_union_id')->default('')->nullable()->comment('老的微信开放平台的unionid');
            /*字段配置--end*/

            /*索引配置--begin*/
            $table->unique('wechat_mp_open_id');
            $table->unique('wechat_app_open_id');
            $table->unique('wechat_web_open_id');
            $table->unique('old_wechat_union_id');
            /*索引配置--end*/
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('user_oauth', function (Blueprint $table) {
            //
        });
    }
}
